﻿// JScript 文件
function $(str){
	return document.getElementById(str);
}
function _(str){
	return document.getElementsByTagName(str);
}
var sHtml = '<div id="myalertmaxdivbox" style="display:none;position:absolute;z-index:900;top:0;left:0;-moz-opacity:0.04;filter:alpha(opacity=4);background-color:#000000;width:100%; height:100%;overflow:hidden;"><img src="http://p.mail.163.com/js31style/lib/images/place.gif" width="100%" height="100%" /></div>'+
'<div id="myalertmsgdivmaxbox" style="display:none;position:absolute;">'+
'<div class="alertmsgtitlediv" onmousedown="drag(event,this)" id="dvSysTitle">'+
'<table class="alertmsgtitletb" style="width:100%;height:100%;">'+
'<tr>'+
'<td class="f1img lftcorner"></td>'+
'<td id="myalertmsgdivtitle" style="text-align:left;" class="f2img midtxt"></td>'+
'<td class="f1img rigcorner"><a href="javascript:void(0)" title="关闭" class="f1img" id="lnkSysClose" onclick="msg_close_tmp_biyuan(0);return false;"></a></td>'+
'</tr>'+
'</table>'+
'</div>'+
'<div id="alertmsgcontentdiv" class="alertmsgcontentdiv"> '+
'<div class="gsw_con_wpin"> '+
'<table border="0" cellpadding="0" cellspacing="0" style="width:100%; height:100%;">'+
'<tr>'+
'<td style="width:60px;text-align:left;" id="alertmsgleftimginfo" class="sw_ico_wp" valign="top"><b class="f1img sw_ico"></b></td>'+
'<td style="width:100%; height:100%;" class="alertmsgcontentinof">'+
'<div id="msg_div_main_msginfo"></div><iframe width="100%" height="100%" src="Message.aspx" frameborder="0" scrolling="auto" id="msg_div_main_content"></iframe>'+
'</td>'+
'</tr>'+
'</table>'+
'</div>'+
'</div>'+
'<div class="alertmsgfootdiv" >'+
'<div class="alertmsgfootbox" id="myalertdvSysBottom">'+
'</div>'+
'</div>'+
'</div>';
document.writeln(sHtml);
var objcocument;
var tempheight=0;
var shorhtml='<div class="hrsub"></div>';
var sCancelHtml = '<input type="button" id="btnSysCancel" class="btn btnnml" value="取 消" onclick="msg_close_tmp_biyuan(0);"  onmouseOver="this.className=\'btn btnhv\'" onmouseout="this.className=\'btn btnnml\'" />';
function AlertMyMsg(boxtitle,boxtype,boxwidth,boxheight,iframeurl,obj,functionboj){
   objcocument=obj;
   var sOkHtml = '<input type="button" id="btnSysOk" class="btn btnnml" onclick="'+functionboj+'" onmouseover="this.className=\'btn btnhv impbtn\'" onmouseout="this.className=\'btn btnnml impbtn\'" value="确 定" />';
	$("myalertmsgdivmaxbox").style.width=boxwidth + "px";
	if(boxtype==3)
	{
	  tempheight=boxheight-30;
	  $("alertmsgcontentdiv").style.height=tempheight + "px";
	}
	else
	{
	   tempheight=boxheight-75;
	   $("alertmsgcontentdiv").style.height=tempheight + "px";
	}
    var w = parseInt(boxwidth);
    var h =parseInt(boxheight)
	var si =document.body.clientWidth;
	var he =document.documentElement.clientHeight||document.body.clientHeight;
	
    var yScrolltop;
    var xScrollleft;
    if (self.pageYOffset || self.pageXOffset) {
        yScrolltop = self.pageYOffset;
        xScrollleft = self.pageXOffset;
    } else if (document.documentElement && document.documentElement.scrollTop || document.documentElement.scrollLeft ){     // Explorer 6 Strict
        yScrolltop = document.documentElement.scrollTop;
        xScrollleft = document.documentElement.scrollLeft;
    } else if (document.body) {// all other Explorers
        yScrolltop = document.body.scrollTop;
        xScrollleft = document.body.scrollLeft;
    }

    var LeftPosition = (si) ? (si-w)/2 : 0  ;
    var TopPosition = (he) ? (he-h)/2 : 0 ;
    TopPosition=TopPosition+parseInt(yScrolltop);
    $("myalertmsgdivmaxbox").style.left = LeftPosition + "px";
	$("myalertmsgdivmaxbox").style.top  = TopPosition + "px";
	switch(boxtype * 1){
		case 1:
		     $("alertmsgleftimginfo").style.display="";
		    $("myalertdvSysBottom").className="alertmsgfootbox";
            $("myalertdvSysBottom").innerHTML=shorhtml+sOkHtml;
			$("msg_div_main_msginfo").innerHTML= iframeurl;
			$("msg_div_main_msginfo").style.display="";
			$("msg_div_main_content").style.display="none";
		break;
		case 2:
		    $("alertmsgleftimginfo").style.display="";
		    $("myalertdvSysBottom").className="alertmsgfootbox";
		    $("myalertdvSysBottom").innerHTML=shorhtml+sCancelHtml+sOkHtml;
			$("msg_div_main_msginfo").innerHTML= iframeurl;
			$("msg_div_main_msginfo").style.display="";
			$("msg_div_main_content").style.display="none";
		break;
		case 3:
		    $("alertmsgleftimginfo").style.display="none";
		    $("myalertdvSysBottom").className="alertmsgfootboxpage";
			$("msg_div_main_msginfo").style.display="none";
			$("msg_div_main_content").src =  iframeurl;
			$("msg_div_main_content").style.display="";
		break;
		defualt:
		    
		    $("alertmsgleftimginfo").style.display="none";
		    $("myalertdvSysBottom").className="alertmsgfootboxpage";
			$("msg_div_main_msginfo").style.display="none";
			$("msg_div_main_content").src =  iframeurl;
			$("msg_div_main_content").style.display="";
		break;
	}
	 $("myalertmsgdivtitle").innerHTML = boxtitle;
     $("myalertmsgdivmaxbox").style.zIndex  = 1000;
	 $("myalertmsgdivmaxbox").style.display = "";
	 $("myalertmaxdivbox").style.display = "";
}
function msg_close_tmp_biyuan(url){
	$('myalertmaxdivbox').style.display='none';
	$('myalertmsgdivmaxbox').style.display='none';
	if(url=="1")
	{
	objcocument.href = objcocument.href;//刷新
	}
	else
	{
	  if(url!="0")
	  {
	   objcocument.href=url;
	  }
	}
}
var oDrag = "";
var ox,oy,dy,dx;
function drag(e,o){
	var e = e ? e : event;
	var mouseD = document.all ? 1 : 0;
	if(e.button == mouseD)
	{
		if (o.parentNode)
		{
			oDrag = o.parentNode;
		}
		else
		{
		    oDrag = o;
		}
		ox = e.clientX;
		oy = e.clientY;
		dx = parseInt(oDrag.style.left);//记录鼠标按下时oDrag的左边距。   
        dy = parseInt(oDrag.style.top);//记录鼠标按下时oDrag的上边距。
        
	}
}
function dragPro(e){
	if(oDrag != "")
	{	
		//var obj=document.getElementById("msg");//拖动的id
		var obj=oDrag;//拖动的id
		var e = e ? e : event;
		obj.style.position = 'absolute';  
        //在原始位置的数据上，加上鼠标移动时产生的偏移量。即为oDrag现在的位置。   
         var mrx = e.clientX - ox;
         var mry = e.clientY - oy;
         if(isNaN(dx)){dx=0;}
		if(isNaN(dy)){dy=0;}
        obj.style.left = parseInt(dx) +mrx + "px";
        obj.style.top = parseInt(dy) + mry + "px";
	}
}
document.onmouseup = function(){oDrag = "";}
document.onmousemove = function(event){dragPro(event);}
